#!/bin/sh

#show histry data for one day
#historyday.sh <stock> mm/dd/yy

export frommonth=`echo $2 |cut -d'/' -f1|awk '{print $1-1}' |bc`
export fromday=`echo $2 |cut -d'/' -f2`
export fromyear=`echo $2 |cut -d'/' -f3`

curl -stderr "http://finance.yahoo.com/q/hp?s=$1&a=$frommonth&b=$fromday&c=$fromyear&d=$frommonth&e=$fromday&f=$fromyear&g=d" |sed 's/tr/\n/g' |egrep -o "[0-9]+-[A-Za-z]+-[0-9]+|[0-9]+.[0-9]+</td></|>[0-9,]+<"  |tr '<\n' ' '|sed 's/td/\n/g' |sed -e 's/>//g' -e 's/\///g' | sed 's/,//g'| awk '{print $3}' 

